/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uni.lpoo.test;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import uni.lpoo.dao.cuentasDAO;
import uni.lpoo.dto.cuentasDTO;
import uni.lpoo.tool.Conexion;

/**
 *
 * @author lucero
 */
public class recepcionDao {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {
     int val = 0;
     String lui = "";
        ArrayList<cuentasDTO> list = null;
        //ArrayList list = null;
        String sql = "Select * from Articulo";
        String driver = "com.mysql.jdbc.Driver";
        String url = "jdbc:mysql://localhost:3306/contabilidad";
        String user = "root";
        String pass = "root";
        
        Conexion conex = new Conexion(driver, url, user, pass);
        Connection cn = conex.getConnectionX();
        Statement stmt = cn.createStatement();
        ResultSet rs = stmt.executeQuery("SELECT * FROM cuentas");
        while (rs.next()) {
            cuentasDTO bean = new cuentasDTO();
          //  static ArrayList<Coche> coches = new ArrayList<Coche>();
           
             //val=rs.getInt(1);
             //lui=rs.getString(2);
             bean.setNumCuenta(rs.getInt(1));
             bean.setNomCuenta(rs.getString(2));
             list.add(bean);
             System.out.println(list.get(val));
              val++;
              
        }
        
     
    }
}
